package com.hand.wfive.view.dialog;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;

import com.hand.wfive.R;
import com.lxj.xpopup.impl.PartShadowPopupView;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class MoreFileCenter extends PartShadowPopupView {
    private OnMoreFileCenterCallBack onMoreFileCenterCallBack;

    public MoreFileCenter(@NonNull Context context) {
        super(context);
    }

    public MoreFileCenter addOnMoreFileCenterCallBack(OnMoreFileCenterCallBack onMoreFileCenterCallBack) {
        this.onMoreFileCenterCallBack = onMoreFileCenterCallBack;
        return this;
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_more_file_center;
    }

    public interface OnMoreFileCenterCallBack {
        void call(int position);
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        ButterKnife.bind(this);
    }

    @OnClick({R.id.tv_1, R.id.tv_2, R.id.tv_3, R.id.tv_4})
    public void onClick(View view) {
        dismiss();
        switch (view.getId()) {
            case R.id.tv_1: {
                if (onMoreFileCenterCallBack != null)
                    onMoreFileCenterCallBack.call(1);
            }
            break;
            case R.id.tv_2: {
                if (onMoreFileCenterCallBack != null)
                    onMoreFileCenterCallBack.call(2);
            }
            break;
            case R.id.tv_3: {
                if (onMoreFileCenterCallBack != null)
                    onMoreFileCenterCallBack.call(3);
            }
            break;
            case R.id.tv_4: {
                if (onMoreFileCenterCallBack != null)
                    onMoreFileCenterCallBack.call(4);
            }
            break;
        }
    }
}
